//
//  CYSelectCardAddCell.m
//  cyjf
//
//  Created by tauCross on 2017/5/15.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "CYSelectCardAddCell.h"



@interface CYSelectCardAddCell ()

@property(nonatomic, strong)UIImageView *iconImageView;
@property(nonatomic, strong)UILabel *titleLabel;
@property(nonatomic, strong)UIImageView *bottomLine;

@end


@implementation CYSelectCardAddCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self)
    {
        self.iconImageView = [[UIImageView alloc] initWithImage:CYImage(@"select_card_add")];
        [self.contentView addSubview:self.iconImageView];
        
        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.textColor = HEXCOLOR(@"444444");
        self.titleLabel.font = [UIFont systemFontOfSize:16];
        self.titleLabel.text = @"使用新卡支付";
        [self.titleLabel sizeToFit];
        [self.contentView addSubview:self.titleLabel];
        
        self.bottomLine = [[UIImageView alloc] initWithImage:[UIImage imageWithColor:HEXCOLOR(@"ECECEC") size:CGSizeMake(1, 1)]];
        [self.contentView addSubview:self.bottomLine];
    }
    return self;
}

+ (CGFloat)heightForObject:(id)object atIndexPath:(NSIndexPath *)indexPath tableView:(UITableView *)tableView
{
    return 65;
}

- (BOOL)shouldUpdateCellWithObject:(id)object
{
    [self setNeedsLayout];
    return YES;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.iconImageView.left = 20;
    self.iconImageView.centerY = self.contentView.height / 2;
    
    self.titleLabel.centerY = self.contentView.height / 2;
    self.titleLabel.left = 63;
    
    self.bottomLine.width = self.contentView.width - 20;
    self.bottomLine.height = 1 / SCREEN_SCALE;
    self.bottomLine.bottom = self.contentView.height;
    self.bottomLine.right = self.contentView.width;
}

@end
